#include <stdio.h>

#define LEN 3

void permutation(char *str, char *pos)
{
	if (*pos == '\0') {
		printf("str:%s\n", str);
		return;
	} else {
		char *p = NULL;
		for (p = pos; *p != '\0'; p++) {
			char tmp = *pos;
			*pos = *p;
			*p = tmp;

			permutation(str, pos + 1);

			tmp = *pos;
			*pos = *p;
			*p = tmp;
		}
	}
}

void per(char *str)
{
	permutation(str, str);
}


int main()
{
	char in[] = "abc";
	per(in);
	return 0;
}

